﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace CSBackup_Web.Models
{
    public class LogInModel : CommonModel
    {
        public LogInModel()
        {
            Title = "登录";
            TabTitles = new List<string> { "登录" };
        }

        [Required(ErrorMessage = "用户名不可为空")]
        [Display(Name = "用户名：")]
        public string userName { get; set; }

        [Required(ErrorMessage = "密码不可为空")]
        [DataType(DataType.Password)]
        [Display(Name = "密码：")]
        public string password { get; set; }
    }

    public class AlterPwModel : CommonModel
    {
        public AlterPwModel()
        {
            Title = "修改密码";
            TabTitles = new List<string> { "修改密码" };
        }

        [DataType(DataType.Password)]
        [Display(Name = "原密码：")]
        public string oldPassword { get; set; }

        [Required(ErrorMessage = "密码不可为空")]
        [DataType(DataType.Password)]
        [Display(Name = "新密码：")]
        [StringLength(15, MinimumLength = 6, ErrorMessage = "密码长度必须为6-15个字符，请重新输入")]
        public string newPassword { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "确认新密码：")]
        [Compare("newPassword", ErrorMessage = "确认密码与新密码不一致")]
        public string confirmPassword { get; set; }
    }

    public class RegisterModel : CommonModel
    {
        public RegisterModel()
        {
            Title = "注册";
            TabTitles = new List<string> { "注册" };
        }
        private string userID = string.Empty;
        private string password = string.Empty;
        private string passwordConfirm = string.Empty;

        [Required(ErrorMessage = "用户名不可为空")]
        [Display(Name = "用户名")]
        public string UserID
        {
            set { userID = value; }
            get { return userID; }
        }

        [Required(ErrorMessage = "密码不可为空")]
        [DataType(DataType.Password)]
        [Display(Name = "密码")]
        public string Password
        {
            set { password = value; }
            get { return password; }
        }

        [DataType(DataType.Password)]
        [Display(Name = "确认密码：")]
        [Compare("Password", ErrorMessage = "确认密码与密码不一致")]
        public string PasswordConfirm
        {
            set { passwordConfirm = value; }
            get { return passwordConfirm; }
        }
    }
}